package com.qf.springcloud.client.factory;

import com.qf.springcloud.client.ProviderClient;
import com.qf.springcloud.client.fallback.ProviderClientFallback;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 为了获取Fallback时，出现的异常信息
 */
@Component
public class ProviderClientFallbackFactory implements FallbackFactory<ProviderClient> {

    @Autowired
    private ProviderClientFallback providerClientFallback;

    @Override
    public ProviderClient create(Throwable cause) {

        cause.printStackTrace();

        return providerClientFallback;
    }
}
